package cn.tedu.spring.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestUser {
    public static void main(String[] args) {
        //创建Spring应用上下文，通过扫描指定的包来寻找带有Spring注解的类
        ApplicationContext context = new AnnotationConfigApplicationContext(
                "cn.tedu.spring.example");
        User user1=context.getBean(User.class);
        System.out.println("user1="+user1);
        user1.userRun();
    }
}
